package com.ziyun.pop.mall.module.user.web;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.service.goods.api.SellerService;
import com.service.goods.constant.GoodsResult;
import com.service.goods.model.seller.SellerInfoVO;
import com.ziyun.pop.mall.module.user.service.PopSellerInfoService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 用户收藏商家
 * @author husong
 *
 */
@Api(value = "UserCollectSellerController",tags = "用户收藏商家Controller")
@Controller
public class UserCollectSellerController {

	private static Logger _log = LoggerFactory.getLogger(UserCollectSellerController.class);
	private static final String MODEL = "/user";
	
	@Autowired
    private SellerService sellerService;
		
	/**
     *工厂详情收藏店铺
     * @return
     */
    @ApiOperation(value = "收藏店铺")
    @PostMapping(MODEL+"/doCollectSeller.do")
    @ResponseBody
    public GoodsResult<Map<String, Boolean>> doCollectSeller(String sellerId){
        HashMap<String, String> map = new HashMap<>();
        map.put("sellerIds", sellerId);
        GoodsResult<Map<String, Boolean>> addUserCollectSeller = sellerService.addUserCollectSeller(map);
        return addUserCollectSeller;
       
    }
    
    /**
     *工厂详情取消收藏店铺
     * @return
     */
    @ApiOperation(value = "取消收藏店铺")
    @PostMapping(MODEL+"/delCollectSeller.do")
    @ResponseBody
    public GoodsResult delCollectSeller(String sellerId){
        HashMap<String, String> map = new HashMap<>();
        map.put("sellerId", sellerId);
        return sellerService.delUserCollectSeller(map);              
    }
	
}
